<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div class="box">
        <p>内容1</p>
        <p>内容2</p>
        <p>内容3</p>
        <p>内容4</p>
        <p>内容5</p>
        <p>内容6</p>
    </div>
    <script>
        var ps = document.querySelectorAll('.box p')
        console.log(ps);
        var boxs = document.querySelector('.box')
        //循环给P标签添加单击事件
        for (var i = 0; i < ps.length; i++) {
            ps[i].onclick = function () {
                //点击谁就删除谁
                boxs.removeChild(this)   //this谁调用就指向谁
            }

        }
    </script>
</body>

</html>